<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<style>
	.main{
        margin: 16px 0 0 0;
        width:100%;
        height:auto;
    }
    .name{
        font-size: 14px;
        font-weight: bold;
        margin-top: 16px;
        height: 48px;
        line-height: 48px;
        padding-left: 16px;
        color: #3F4F60;
        border-radius: 4px;
        background: #fff;
    }
    .echart-box{
        background: #fff;
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 4px;
    }
    .echart-box{
        clear: both;
        overflow: hidden;
    }
    .echart-box .item{
        float: left;
        width: 31%;
        margin-right: 2.333%;
        border-radius: 4px;
    }
    .echart-box .tit{
        font-size: 18px;
        padding: 0 0 16px 0;
        color: #06172A;
        position: relative;
        font-weight: bold;
        margin: 0 2px 10px 0;
        border-bottom: 1px solid #dfe3e6;
    }
    .echart-box .text{
        color: #5a5f72;
        margin: 8px 0;
        position: relative;
        padding-left: 10px;
     }
    .echart-box .text:after{
        content: '';
        width: 4px;
        height: 14px;
        background: #2C82EB;
        position: absolute;
        left: 0;
        top: 50%;
        margin-top: -7px;
    }
    .echart-box .num{
        font-size: 30px;
        font-size: bold;
        padding-bottom: 8px;
        border-bottom: 1px solid #ccc;
    }
    .echart-box-two{
        background: #fff;
        padding: 18px;
    }
    .echart-box-two .item{
        background: #fff;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <p class="name">全国职业院校技能大赛 -- 婴幼儿健康养育照护</p>
    <div id="main" class="main">
        <div class="echart-box-two echart-box">
            <div class="item" style="width: 58.5%;margin-right: 1%">
                <p class="tit">总得分占比--折线图</p>
                <div id="totalProportion" style="height:456px;"></div>
            </div>
            <div class="item"  style="width: 39.5%;margin-right: 0">
                <p class="tit" >总得分占比</p>
                <div id="scoreEcharts" style="height:456px;"></div>
            </div>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script src="/js/plugins/echarts/echarts.min.js"></script>
<script type="text/javascript" >
    $(function() {

        $.ajax({
            url: "/jzweb/examinationCostStatistic/totalScoreList",
            type: "get",
            data: {
            },
            success: function (r) {
                if(r==null){
                    layer.msg("未查询到数据！");
                }
                else {
                    let getData = r.data
                    cteated(402).then((res) => {
                        let colors = res
                        totalProportion(getData?.totalScoreXList,getData?.totalScoreList,colors) //总比分占比
                    })
                    scoreEcharts(getData?.totalScorePercentage) //总得分占比
                }
            }
        });



    })
    function totalProportion(x,y,colors){
        var dom = document.getElementById("totalProportion");
        var myChart = echarts.init(dom);
        var option;
        option = {
            // tooltip: {
            //     trigger: 'axis'
            // },
            // tooltip: {
            //     trigger: 'axis',
            //
            //     //formatter: '{b} : {c}人',
            // },
            legend: {//图例
                show:false,
                x : 'center',
                y : 'bottom',
                itemHeight: 12,                      //修改icon图形大小
                icon: 'circle',                         //图例前面的图标形状
                // textStyle: {                            //图例文字的样式
                //     color: '#a1a1a1',               //图例文字颜色
                //     fontSize: 12                      //图例文字大小
                // }
            },
            grid: {
                left: '0',
                right: '0',
                bottom: '0',
                containLabel: true
            },
            // toolbox: {
            //     feature: {
            //         saveAsImage: {}
            //     }
            // },
            xAxis: {
                // show:false,
                // type: 'category',
                // boundaryGap: true, // 将 boundaryGap 设置为 true
                // data: ['得分区间分布图','得分区间分布图','得分区间分布图','得分区间分布图']
                type: 'category',
                axisTick: {
                    alignWithLabel: true
                },
                axisLine: {
                    lineStyle: {
                        color: '#FFC5C5' // 修改x轴颜色为红色
                    }
                },
                axisLabel: {
                    show: true, // 是否显示刻度标签，默认显示
                    margin: 16, // 刻度标签与轴线之间的距离
                    color:'#3F4F60',
                },
                data: x
            },
            yAxis: {
                type: 'value',
                data: [18, 19, 20,21,23],
            },

            series: [
                {
                    data: y,
                    type: 'line',
                    color:'#F50000',
                    smooth: true,
                    lineStyle: {
                        color: colors // 设置线的颜色为红色
                    },
                    label: {
                        show: true,
                        position: 'top',
                        color:'#3F4F60'
                    },
                    lineStyle: {
                        type: 'dashed' // 设置为虚线
                    }
                }
            ]
        };
        if (option && typeof option === 'object') {
            myChart.setOption(option);
        }
    }
    function scoreEcharts(data) {
        var dom = document.getElementById("scoreEcharts");
        var myChart = echarts.init(dom);
        var option;
        option = {
            // tooltip: {
            //     trigger: 'item',
            //     formatter: '{b} : {c}',
            //     // formatter: "{a} <br/>{b}: {c} ({d}%)",
            // },
            grid: {
                top: '1%', // 控制饼图距离容器顶部的距离
                left: 'center' // 控制饼图水平居中显示
            },
            legend: {//图例
                show:false,
                x : '86%',
                y : 'center',
                itemHeight: 12,                      //修改icon图形大小
                icon: 'circle',                         //图例前面的图标形状
                // textStyle: {                            //图例文字的样式
                //     color: '#a1a1a1',               //图例文字颜色
                //     fontSize: 12                      //图例文字大小
                // }
            },
            series: [
                {
                    color: ['#4D7EFF', '#FB5E58','#BFB3FF','#A1E6CF','#45C9E6','#48d1cc'],
                    name: '',
                    type: 'pie',
                    radius: ['35%', '55%'],
                    label: {
                        show: false,
                        position: 'center'
                    },
                    labelLine: {
                        show: false
                    },
                    data: data,

                    labelLine:{
                        normal:{
                            length:45,     // 指示线宽度
                            // lineStyle: {
                            //     color: "#595959"    // 指示线颜色
                            // }
                        },
                    },
                    label: {
                        normal: {
                            // 各分区的提示内容
                            // params: 即下面传入的data数组,通过自定义函数，展示你想要的内容和格式
                            formatter: function(params){
                                return params.name+"\n\n"+params.percent+"%";
                            },
                            textStyle: {            // 提示文字的样式
                                color: '#3F4F60',
                                fontSize: 12
                            }
                        }
                    }
                }
            ]
        };
        if (option && typeof option === 'object') {
            myChart.setOption(option);
        }

    }

</script>
</body>
</html>